package com.dd.cloud.user.service.order;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dd.cloud.common.vo.PageVo;
import com.dd.cloud.user.entity.order.OrderPay;
import com.dd.cloud.user.req.consult.ConsultNotPayReq;
import com.dd.cloud.user.req.order.*;
import com.dd.cloud.user.res.order.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * 订单表 服务类
 * </p>
 *
 * @author czg
 * @since 2022-09-03
 */
public interface IOrderPayService extends IService<OrderPay> {
    /**
     * 订单退款
     *
     * @param orderNo
     * @param delBo
     * @return
     */
    void refund(String orderNo, int delBo);

    /**
     * 删除订单
     *
     * @param tencode
     */
    void delOrder(String tencode);

    /**
     * 创建订单
     *
     * @param request
     * @param req
     * @return
     */
    PayOrderResponse<?> createOrder(HttpServletRequest request, CreateOrderReq req, Integer sourceType);

    /**
     * 重新支付未支付订单
     *
     * @param request
     * @param req
     * @return
     */
    PayOrderResponse payUnPayOrder(HttpServletRequest request, PayUnOrderReq req);

    /**
     * 查询订单编号通过服务编号
     *
     * @param serverNo
     * @return
     */
    String queryOrderNoByServerNo(String serverNo);

    /**
     * 查询处方订单列表
     *
     * @param req
     * @return
     */
    IPage<OrderPresPageRes> queryOrderPresPage(OrderPresPageReq req);

    /**
     * 查询处方订单列表 运营后台
     *
     * @param req
     * @return
     */
    IPage<OrderPresAdminPageRes> queryOrderPresAdminPage(OrderPresAdminPageReq req);

    /**
     * 查询处方订单列表 运营后台 导出excel
     *
     * @param response
     * @param req
     */
    void exportOrderPresAdminExcel(HttpServletResponse response, OrderPresAdminPageReq req);

    /**
     * 查询处方订单列表 药房后台
     *
     * @param req
     * @return
     */
    IPage<OrderPresPharmacyPageRes> queryOrderPresPharmacyPage(OrderPresPharmacyPageReq req);

    /**
     * 查询处方交易明细列表 药房后台
     *
     * @param req
     * @return
     */
    PageVo<OrderPresDetailListRes> queryOrderPresDetailListPage(OrderPresDetailListReq req);

    /**
     * 导出处方交易明细列表 药房后台
     *
     * @param req
     * @param response
     */
    void exportOrderPresDetailList(OrderPresDetailListReq req, HttpServletResponse response);

    /**
     * 查询处方收入统计列表 药房后台
     *
     * @param req
     * @return
     */
    PageVo<OrderPresIncomeStatisticsListRes> queryOrderPresIncomeStatisticsList(OrderPresIncomeStatisticsListReq req);

    /**
     * 导出处方收入统计列表 药房后台
     *
     * @param req
     * @param response
     */
    void exportOrderPresIncomeStatisticsList(OrderPresIncomeStatisticsListReq req, HttpServletResponse response);

    /**
     * 查询处方订单收益列表
     *
     * @param req
     * @return
     */
    PageVo<OrderProfitPageRes> queryOrderProfitPage(OrderProfitPageReq req);

    /**
     * 查询订单详情
     *
     * @param orderNo
     * @return
     */
    OrderPresDetailRes queryOrderPresDetail(String orderNo);

    /**
     * 结算订单
     *
     * @param req
     */
    void settlementOrder(OrderSettlementReq req);

    /**
     * 导出处方订单收益列表excel
     *
     * @param response
     * @param req
     * @return
     */
    void exportOrderProfitExcel(HttpServletResponse response, OrderProfitPageReq req);

    /**
     * 查询机构统计列表
     *
     * @param req
     * @return
     */
    IPage<OrderStatisticsPageRes> queryOrderStatisticsPage(OrderStatisticsPageReq req);

    /**
     * 导出机构统计列表excel
     *
     * @param response
     * @param req
     * @return
     */
    void exportOrderStatisticsExcel(HttpServletResponse response, OrderStatisticsPageReq req);

    /**
     * 机构支付统计列表
     *
     * @param req
     * @return
     */
    PageVo<MechanPayStatisticsPageRes> queryMechanPayStatisticsPage(MechanPayStatisticsPageReq req);

    /**
     * 医生支付统计列表
     *
     * @param req
     * @return
     */
    PageVo<DoctorPayStatisticsPageRes> queryDoctorPayStatisticsPage(DoctorPayStatisticsPageReq req);

    /**
     * 查询订单情况
     *
     * @param orderNo
     * @return
     */
    OrderPay getOrderPay(String orderNo);

    /**
     * 取消订单
     *
     * @param orderNo
     */
    void cancelOrder(String orderNo, Integer type);

    /**
     * 查询订单流水列表
     *
     * @param tencode
     * @return
     */
    List<OrderFlowListRes> queryOrderFlowListByTencode(String tencode);

    /**
     * 查询问诊处方订单
     *
     * @param inquiryOrderReq
     * @return IPage<InquiryPresRes>
     */
    IPage<InquiryPresRes> selectInquiryPres(InquiryPresReq inquiryOrderReq);

    /**
     * 查询问诊订单
     *
     * @param inquiryOrderReq
     * @return IPage<InquireOrderRes>
     */
    IPage<InquireOrderRes> selectInquiryOrder(InquiryOrderReq inquiryOrderReq);

    /**
     * 退款
     *
     * @param orderNo
     */
    void refundOrder(String orderNo);

    /**
     * 删除订单
     *
     * @param orderNo
     */
    void updateOrderStatus(String orderNo);

    /**
     * 问诊订单立即支付
     *
     * @param req
     * @param request
     * @return
     */
    PayOrderResponse<?> orderPayagain(HttpServletRequest request, ConsultNotPayReq req);

    void testRefundOrder(String orderNo);

    /**
     * 查看是否退款成功
     *
     * @param orderNo
     */
    String refundIsSuccess(String orderNo);
}
